--空甲萧兮
local kongjiaxiaoxi = fk.CreateSkill {
    name = "mcdh_kongjiaxiaoxi",
    tags = {Skill.Compulsory}
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

kongjiaxiaoxi:addEffect(fk.AfterCardsMove,{
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(self) then
                for _, move in ipairs(data) do
                    if move.from == player.id and move.toArea == Card.DiscardPile and move.moveReason == fk.ReasonDiscard then
                        self.cost_data = {}
                        for _, info in ipairs(move.moveInfo) do
                            if info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip then
                                local card = Fk:getCardById(info.cardId)
                                if card.is_damage_card or card.sub_type == Card.SubtypeWeapon then
                                    table.insertIfNeed(self.cost_data, info.cardId)
                                end
                            end
                        end
                        return #self.cost_data > 0
                    end
                end
        end
        return false
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
            player:addToPile("mcdh_kongjiaxiaoxi_pile", self.cost_data, true, self.name)
            room:drawCards(player, 1)
    end,
})

Fk:loadTranslationTable {
    ["mcdh_kongjiaxiaoxi"] = "空胄",
    [":mcdh_kongjiaxiaoxi"] = "『空甲萧兮』<br>锁定技，当你因弃置而失去牌后，将其中所有伤害牌和武器牌（至少一张）置于武将牌上，称「叹」，并摸一张牌。当你受到伤害后，你将至少一张「叹」交给伤害来源。",
    ["mcdh_kongjiaxiaoxi_pile"] = "叹",
    ["#mcdh_kongjiaxiaoxi-choice"] = "空甲萧兮:选择要交给 %src 的「叹」",
}

return kongjiaxiaoxi